<?php defined('BASEPATH') or exit('No direct script access allowed'); ?>

<style>
	
	.ui-widget-header {
		background: url("{{url:base}}media/jquery-ui/css/custom-theme/images/ui-bg_highlight-soft_75_cccccc_1x100.png") repeat-x scroll 50% 50% #CCCCCC !important;
		border: 1px solid #AAAAAA !important;
		color: #222222 !important;
		font-weight: bold !important;
	}
	.ui-widget {
	   font-size: 0.8em !important;
	}
	
</style>

<?php 
	$ci= &get_instance();
	$task = $ci->uri->segment(4,'');
	$task_array = array('dashboard', 'personal_info', 'appareance', 'services', 'rates', 'contact_info', 'pictures_videos');
?> 
<div id="content-left">
	<div id="personal-tabs" class="ui-tabs ui-widget ui-widget-content ui-corner-all">
		<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
			<li id="personal_dashboard" class="ui-state-default ui-corner-top ui-tabs-first-non-selected"><a href="<?php echo site_url_lang('escorts/profile/dashboard');?>" ><?php echo language_translate('profile_page_dashboard');?></a></li>
			<li id="personal_personal_info" class="ui-state-default ui-corner-top"><a href="<?php echo site_url_lang('escorts/profile/personal_info');?>" ><?php echo language_translate('profile_page_personal_info');?></a></li>
			<li id="personal_appareance" class="ui-state-default ui-corner-top"><a href="<?php echo site_url_lang('escorts/profile/appareance');?>" ><?php echo language_translate('profile_page_appareance');?></a></li>
			<li id="personal_services" class="ui-state-default ui-corner-top"><a href="<?php echo site_url_lang('escorts/profile/services');?>"><?php echo language_translate('profile_page_services');?></a></li>
			<li id="personal_rates" class="ui-state-default ui-corner-top"><a href="<?php echo site_url_lang('escorts/profile/rates');?>"><?php echo language_translate('profile_page_rates');?></a></li>
			<li id="personal_contact_info" class="ui-state-default ui-corner-top"><a href="<?php echo site_url_lang('escorts/profile/contact_info');?>"><?php echo language_translate('profile_page_contact_info');?></a></li>
			<li id="personal_pictures_videos" class="ui-state-default ui-corner-top"><a href="<?php echo site_url_lang('escorts/profile/pictures_videos');?>"><?php echo language_translate('profile_page_pictures_videos');?></a></li>
			<li id="personal_end_tab" class="ui-state-default ui-corner-top ui-tabs-last-non-selected"><a href="#">&nbsp;</a></li>
		</ul>
		
		<?php if($task === 'dashboard' OR !in_array($task, $task_array)):?>
			<div id="tabs-1" class="ui-tabs-panel ui-widget-content ui-corner-bottom">
				<?php $this->load->view('escorts/tabs/dashboard'); ?>
			</div>
		<?php endif; ?>
		
		<?php if($task === 'personal_info' ):?>
			<div id="tabs-2" class="ui-tabs-panel ui-widget-content ui-corner-bottom">
				<?php $this->load->view('escorts/tabs/personal_info'); ?>
			</div>
		<?php endif; ?>	
		
		<?php if($task === 'appareance' ):?>
			<div id="tabs-3" class="ui-tabs-panel ui-widget-content ui-corner-bottom">
				<?php $this->load->view('escorts/tabs/appareance'); ?>
			</div>
		<?php endif; ?>	
		
		<?php if($task === 'services' ):?>
			<div id="tabs-4" class="ui-tabs-panel ui-widget-content ui-corner-bottom">
				<?php $this->load->view('escorts/tabs/services'); ?>
			</div>
		<?php endif; ?>	
		
		<?php if($task === 'rates' ):?>
			<div id="tabs-5" class="ui-tabs-panel ui-widget-content ui-corner-bottom">
				<?php $this->load->view('escorts/tabs/rates'); ?>
			</div>
		<?php endif; ?>	
		
		<?php if($task === 'contact_info' ):?>
			<div id="tabs-6" class="ui-tabs-panel ui-widget-content ui-corner-bottom">
				<?php $this->load->view('escorts/tabs/contact_info'); ?>
			</div>
		<?php endif; ?>	
		
		<?php if($task === 'pictures_videos' ):?>
			<div id="tabs-7" class="ui-tabs-panel ui-widget-content ui-corner-bottom">
				<?php $this->load->view('escorts/tabs/pictures_videos'); ?>
			</div>
		<?php endif; ?>	
		
		 
	</div>
</div>

<?php $this->load->view('escorts/right_nav'); ?>

		
<script type="text/javascript">
	var PROFILE_TASK = '<?php echo $task;?>';
	$(document).ready(function() {
		$('#personal_dashboard,#personal_personal_info,#personal_appareance,#personal_services,#personal_rates,#personal_contact_info,#personal_pictures_videos,#personal_end_tab').removeClass('ui-tabs-selected ui-state-active');
		switch(PROFILE_TASK){
			case 'dashboard':
			default:
				$('#personal_dashboard').removeClass('ui-tabs-first-non-selected').addClass('ui-tabs-selected ui-state-active');
				$('#personal_personal_info').addClass('ui-tabs-next-to-selected');
				break;
			case 'personal_info':
				$('#personal_personal_info').addClass('ui-tabs-selected ui-state-active');
				$('#personal_appareance').addClass('ui-tabs-next-to-selected');
				break;
			case 'appareance':
				$('#personal_appareance').addClass('ui-tabs-selected ui-state-active');
				$('#personal_services').addClass('ui-tabs-next-to-selected');
				break;	
			case 'services':
				$('#personal_services').addClass('ui-tabs-selected ui-state-active');
				$('#personal_rates').addClass('ui-tabs-next-to-selected');
				break;	
			case 'rates':
				$('#personal_rates').addClass('ui-tabs-selected ui-state-active');
				$('#personal_contact_info').addClass('ui-tabs-next-to-selected');
				break;	
			case 'contact_info':
				$('#personal_contact_info').addClass('ui-tabs-selected ui-state-active');
				$('#personal_pictures_videos').addClass('ui-tabs-next-to-selected');
				break;	
			case 'pictures_videos':
				$('#personal_pictures_videos').addClass('ui-tabs-selected ui-state-active');
				$('#personal_end_tab').addClass('ui-tabs-next-to-selected');
				break;	
		} 
		
		var options = { 
			beforeSubmit:  validateB4SubmitSendMessage,  
			success:       processAfterRespondingSendMessage   
		};
		$("#submit_send_message").live("submit",function(e){
			e.preventDefault(); // <-- important
			$(this).ajaxSubmit(options);
			return false;
		});	
	
	});	
	
	function open_question_dialog(escort_id){
		$('#greyDiv').removeClass('hidden');
		$.post(BASE_URI+'escorts/async/load_send_message_form',{escort_id:escort_id},function(res){
			
			$('#hiddenElement').html(res);
			$('#hiddenElement').dialog(
				{
					 width: 550,
					 height:350 ,
					 draggable: false,
					 beforeClose: function(event, ui) { 
						$('#greyDiv').addClass('hidden');
					 },
					 close: function(event, ui) { },
					 title: '<?php echo language_translate('support_label_send_message_title');?>' 
				}
			);
			$('.ui-dialog').center();
		});
	}
	
	function validateB4SubmitSendMessage(formData, jqForm, options){
		$('.loading_update_image').show();
		return true;
	}

	function processAfterRespondingSendMessage(responseText, statusText, xhr, $form) {
		$('.loading_update_image').hide();	
		res = JSON.parse(responseText);
		if(res.result == 'ok'){
			$('#wrap-delete-item').remove();
			updatedShow('message-status');
			$('.unread_number').text(res.unreadMsg);
		}else{
			debug(responseText);
		}
	}

	
</script>		
		